package com.jinhongone.pattern.behavior.observer.JdkExample;

import java.util.Observable;
import java.util.Observer;

/**
 * @author jinho
 * @className Police
 * @description 观察者（通过java实现）
 * @date 2025/4/16 16:31
 */
public class Police implements Observer {

    private String name;

    public Police(String name) {
        this.name = name;
    }

    @Override 
    public void update(Observable o, Object arg) {
        System.out.println("警察：" + name + "对小偷：" + ((Thief) o).getName() + "说:你被捕了");
    }
}
